/**
 * 
 * 全局方法
 * 
 */
class Utils {
    /**
      * 根据name关键字创建一个Bitmap对象。name属性请参考resources/resource.json配置文件的内容。
      * Create a Bitmap object according to name keyword.As for the property of name please refer to the configuration file of resources/resource.json.
      */
    public static createBitmapByName(name: string): egret.Bitmap {
        let result = new egret.Bitmap();
        let texture: egret.Texture = RES.getRes(name);
        result.texture = texture;
        return result;
    }
    /** 
     * 锚点居中, 传入一个显示对象, 设置它的锚点居中到自己正中心;
     */
    public static anchorCenter(item: any): void {
        item.anchorOffsetX = item.width / 2;
        item.anchorOffsetY = item.height / 2;
    }

}